<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.7/iconfont.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>推广设置</title>
</head>
<body>
<div class="pd-20">
	<form action="" method="post" class="form form-horizontal" id="form1">
		<input type="hidden" name="id" id="id">
		<div class="row cl">
			<label class="form-label col-3">提交置换提成百分比：</label>
			<div class="formControls col-4">
				<input type="text" class="input-text" value="" placeholder="" id="change_percentage" name="change_percentage">
			</div>
			<div class="col-3"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-3">置换物品提成百分比：</label>
			<div class="formControls col-4">
				<input type="text" autocomplete="off" value="" class="input-text" name="buy_percentage" id="buy_percentage">
			</div>
			<div class="col-3"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-3">结算最低限额：</label>
			<div class="formControls col-4">
				<input type="text" autocomplete="off" value="" class="input-text" name="withdrawal_count" id="withdrawal_count">
			</div>
			<div class="col-3"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-3">注册得到的券数量：</label>
			<div class="formControls col-4">
				<input type="text" autocomplete="off" value="" class="input-text" name="register_ticket" id="register_ticket">
			</div>
			<div class="col-3"> </div>
		</div>


		<div class="row cl">
			<label class="form-label col-3">上级获取的提交置换提成百分比：</label>
			<div class="formControls col-4">
				<input type="text" class="input-text" value="" placeholder="" id="change_percentage_sub" name="change_percentage_sub">
			</div>
			<div class="col-3"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-3">上级获取的置换物品提成百分比：</label>
			<div class="formControls col-4">
				<input type="text" autocomplete="off" value="" class="input-text" name="buy_percentage_sub" id="buy_percentage_sub">
			</div>
			<div class="col-3"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-3">上级获取的注册得到的券数量：</label>
			<div class="formControls col-4">
				<input type="text" autocomplete="off" value="" class="input-text" name="register_ticket_sub" id="register_ticket_sub">
			</div>
			<div class="col-3"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-3">获得的券的天数：</label>
			<div class="formControls col-4">
				<input type="text" autocomplete="off" value="" class="input-text" name="overdue_day" id="overdue_day">
			</div>
			<div class="col-3"> </div>
		</div>
		
		<div class="row cl">
			<div class="col-9 col-offset-3">
				<input class="btn btn-primary radius" type="button" id="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</div>
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 

<script type="text/javascript" src="lib/Validform/5.3.2/Validform.min.js"></script> 
<script type="text/javascript" src="lib/layer/2.1/layer.js"></script> 
<script type="text/javascript" src="js/H-ui.js"></script> 
<script type="text/javascript" src="js/H-ui.admin.js"></script> 
<script type="text/javascript" src="js/s.js"></script> 
<script type="text/javascript">


$(function(){
var API=API_TGSET;



$.getJSON(API,function(data){
	if(!checkStatus(data)) return;

	$("input[name='id']").val(data.datas.id);
	$("input[name='buy_percentage']").val(data.datas.buy_percentage);
	$("input[name='change_percentage']").val(data.datas.change_percentage);
	$("input[name='register_ticket']").val(data.datas.register_ticket);	
    $("input[name='withdrawal_count']").val(data.datas.withdrawal_count);

    $("input[name='overdue_day']").val(data.datas.overdue_day);
	$("input[name='register_ticket_sub']").val(data.datas.register_ticket_sub);
	$("input[name='buy_percentage_sub']").val(data.datas.buy_percentage_sub);	
    $("input[name='change_percentage_sub']").val(data.datas.change_percentage_sub);
})

$(document).on('click','input#submit',function(){
	var id=$("input[name='id']").val();
	console.log(id)
	var buy_percentage=$.trim($("input[name='buy_percentage']").val());
	var change_percentage=$.trim($("input[name='change_percentage']").val());
	var register_ticket=$.trim($("input[name='register_ticket']").val());
	var withdrawal_count=$.trim($("input[name='withdrawal_count']").val());

	var overdue_day=$.trim($("input[name='overdue_day']").val());
	var register_ticket_sub=$.trim($("input[name='register_ticket_sub']").val());
	var buy_percentage_sub=$.trim($("input[name='buy_percentage_sub']").val());
	var change_percentage_sub=$.trim($("input[name='change_percentage_sub']").val());

	if(buy_percentage=="" && change_percentage=="" && register_ticket=="" && withdrawal_count==""){
		layer.msg("请至少选填一项", {icon:2,time:1000});
		return;
	}
	$.post(API,{
		id                : id,
		buy_percentage    : buy_percentage,
		change_percentage : change_percentage,
		register_ticket   : register_ticket,
		withdrawal_count  : withdrawal_count,

		overdue_day    : overdue_day,
		register_ticket_sub : register_ticket_sub,
		buy_percentage_sub   : buy_percentage_sub,
		change_percentage_sub  : change_percentage_sub,
	},function(data){
		if(!checkStatus(data)) return;
		layer.msg(data.info, {icon:1,time:1000});
	},'json')

})
	

	

	// Validformsubmit("#form1");
});
</script>
</body>
</html>